/*
 * thread.cpp
 *
 *  Created on: 2016年2月24日
 *      Author: Administrator
 */

#include "thread_pool_worker.h"
#include "thread_pool.h"

namespace eyas {
namespace thread {

thread_pool_worker::thread_pool_worker(thread_pool *thpool)
:thread_pool_(thpool), enable_(true), thread_(boost::bind(&thread_pool_worker::thread_proc, this)){
}

thread_pool_worker::~thread_pool_worker() {
	enable_ = false;
	//this->thread_pool_->do_kill(this->get_thread_id());
	this->thread_.join();
	this->thread_pool_ = nullptr;
}
void thread_pool_worker::thread_proc(){
	while(enable_){
		this->thread_pool_->work(this);
	}
}

}
}
